//
//  XDAllScenicTableViewCell.m
//  Le way walkers
//
//  Created by YaZhiLiang on 15/5/27.
//  Copyright (c) 2015年 LTXZ. All rights reserved.
//

#import "XDAllScenicTableViewCell.h"

@implementation XDAllScenicTableViewCell


- (instancetype)initWithStyle:(UITableViewCellStyle)style reuseIdentifier:(NSString *)reuseIdentifier
{
    self = [super initWithStyle:style reuseIdentifier:reuseIdentifier];
    
    if (self) {
     
        [self createSubCell];
    }
    
    return self;
    
}

- (void)createSubCell
{

    self.imageview = [[UIImageView alloc]init];
    
    self.imageview.frame = CGRectMake(self.contentView.frame.origin.x + 10, self.contentView.frame.origin.y + 10, self.contentView.frame.size.width / 2 - 20, self.contentView.frame.size.width / 2- 20);
    
    self.imageview.layer.cornerRadius = 5;
    
    self.imageview.layer.masksToBounds = YES;
    
//    self.imageview.backgroundColor = [UIColor blackColor];
    
    [self.contentView addSubview:self.imageview];
    
    [_imageview release];
    
    self.nameLabel = [[UILabel alloc]init];
    
    self.nameLabel.frame = CGRectMake(self.contentView.frame.origin.x + self.imageview.frame.origin.x + self.imageview.frame.size.width + 20, self.imageview.frame.origin.y, self.contentView.frame.size.width - self.imageview.frame.origin.x - self.imageview.frame.size.width - 5, 40);
    
    self.nameLabel.font = [UIFont fontWithName:@"Arial-BoldItalicMT" size:18.0];
    
//    self.nameLabel.backgroundColor = [UIColor blackColor];
    
    [self.contentView addSubview:self.nameLabel];
    
    [_nameLabel release];
    
    self.wish_to_go_count = [[UILabel alloc]init];
    
    
    self.wish_to_go_count.frame = CGRectMake(self.nameLabel.frame.origin.x, self.imageview.frame.origin.y + self.imageview.frame.size.height - 30, self.nameLabel.frame.size.width, 30);
    
    self.wish_to_go_count.font = [UIFont systemFontOfSize:14.0];
    
//    self.wish_to_go_count.backgroundColor = [UIColor blackColor];
    
    [self.contentView addSubview:self.wish_to_go_count];
    
    [_wish_to_go_count release];
    
}

- (void)setXdplaceAll:(XDPlaceAllScenic *)xdplaceAll
{
    if (_xdplaceAll != xdplaceAll) {
        
        [_xdplaceAll release];
        
        _xdplaceAll = [xdplaceAll retain];
    }
    
    [self.imageview sd_setImageWithURL:[NSURL  URLWithString:xdplaceAll.cover_s] placeholderImage:[UIImage imageNamed:@"69E58PIChJC_1024.jpg"]];
    
    self.nameLabel.text = xdplaceAll.name;
    
    self.wish_to_go_count.text = [NSString stringWithFormat:@"%@ 人去过", xdplaceAll.wish_to_go_count];
    
    self.type = xdplaceAll.type;
    
    self.ScenicID = xdplaceAll.ScenicID;
    
}


- (void)awakeFromNib {
    // Initialization code
}

- (void)setSelected:(BOOL)selected animated:(BOOL)animated {
    [super setSelected:selected animated:animated];

    // Configure the view for the selected state
}

@end
